<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2>用户反馈管理 </h2>
    </div>

    <div class="cf">
        <a class="btn r0" href="__ACTION__/record/0">待记录</a>
        <a class="btn r1" href="__ACTION__/record/1">已记录</a>
        <a class="btn c1" style="display: none;background: #0c7dac;">删除所选</a>
        <a class="btn c0" style="display: none;background: #0c7dac;">记录所选</a>
        <!-- 高级搜索 -->
        <!-- <div class="search-form fr cf">
            <div class="sleft">
                <input type="text" name="title" class="search-input" value="{:I('title')}" placeholder="请输入菜单名称">
                <a class="sch-btn" href="javascript:;" id="search" url="__SELF__"><i class="btn-search"></i></a>
            </div>
        </div> -->
    </div>

    <div class="data-table table-striped">
        <form class="ids" action="__CONTROLLER__/edit" method="post">
            <table>
                <thead>
                    <tr>
                        <th class="row-selected">
                            <input class="checkbox check-all" type="checkbox">
                        </th>
                        <th>用户昵称</th>
                        <th>反馈内容</th>
                        <th>提交时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
				<notempty name="lists">
                <volist name="lists[0]" id="v">
                    <tr>
                        <td><input class="ids row-selected" type="checkbox" name="ids[]" value="{$v.id}"></td>
                        <td>
                            <a href="javascript:;">{$v.nickname}</a>
                        </td>
                        <td>{$v.content}</td>
                        <td>{$v.create_time|date='Y/m/d H:i:s',###}</td>
                        <td>
                            <a class="oper" href="javascript:;" data="{$v.id}" val='1' flag="record">
                                <neq name="Think.get.record" value="1">记录</neq>
                            </a>
                            <a class="oper" href="javascript:;" data="{$v.id}" val='0' flag="status"><eq name="Think.get.record" value="1">删除</eq></a>
                        </td>
                    </tr>
                </volist>
				<else/>
				<td colspan="10" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
                </tbody>
            </table>
            <input type="hidden" name="flag" value="" />
        </form>
        <!-- 分页 -->
        <div class="page">
            {$lists[1]}
        </div>
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        $(function() {
            $('.oper').click(function(){
                var mes = $(this).html();
                if (confirm('确定要' + mes + '吗？')) {
                    var id = $(this).attr('data');
                    var val = $(this).attr('val');
                    var flag = $(this).attr('flag');
                    $.post('__CONTROLLER__/edit', {'id': id,'val':val, 'flag':flag}, function(msg) {
                        alert(msg);
                        location.reload();
                    });   
                }                             
            });

            //记录按钮默认颜色
            $('.r' + "{$Think.get.record}").css('background','#0c7dac');
            
            //导航高亮
            highlight_subnav('{:U('index')}');

            //回车搜索
            $(".search-input").keyup(function(e) {
                if (e.keyCode === 13) {
                    $("#search").click();
                    return false;
                }
            });

            $('input').change(function(){
                var sum = $('input:checked').length;
                var record = '{$Think.get.record}';
                if (sum > 1) {
                    $('.c'+record).show(400);                   
                } else {
                    $('.c'+record).hide(400);
                }
            });

            $('.c1').click(function(){
                sub('status');
            });
            $('.c0').click(function(){
                sub('record');
            });

            function sub(val){
                $('input[name=flag]').val(val);
                $('form').submit();
            }
            
        });
    </script>
</block>